package P04集合线程安全.P03_HashMap;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class P02_Solution01_ConcurrentHasMap {
    public static void main(String[] args) {
        Map<String,String> map = new ConcurrentHashMap<>();
        for (int i = 0; i < 100; i++) {
            String key = String.valueOf(i);
            new Thread(() ->{
                map.put(key, UUID.randomUUID().toString().substring(0, 8));
                System.out.println(map);
            }, key).start();
        }
    }
}
